<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/templates/template.xhtml">
	<ui:define name="tituloPagina">Bem vindo ao sistema locação</ui:define>
	<ui:define name="conteudoPrincipal">
	
		<p:panel header="Cadastre seu veículo" style="width:600px;">
			<h:panelGrid columns="3">
				<h:outputLabel style="font-weight:bold" for="marca" value="Marca: " />
				<p:selectOneMenu  required="true" requiredMessage="Campo Obrigatório" converter="genericEntityConverter"
					style="width:300px;" id="marca" value="#{caracteristicasBean.veiculo.marca}">
					<f:selectItems value="#{carrosBean.buscarMarca()}"
					var="marca" itemLabel="#{marca.nome}" itemValue="#{marca}"/>
				</p:selectOneMenu>
				<p:message for="marca"  >
				</p:message>
			
				<p:outputLabel style="font-weight:bold" value="Modelo: "
					for="modelo" />
				<p:inputText required="true" requiredMessage="Campo Obrigatório"
					id="modelo" value="#{caracteristicasBean.veiculo.modelo}" />
				<p:message for="modelo">
				</p:message>

				<p:outputLabel style="font-weight:bold" value="Placa: " for="placa" />
				<p:inputMask mask="aaa-9999" size="8" required="true"
					requiredMessage="Campo Obrigatório" id="placa"  validator="ValidarPlaca" value="#{caracteristicasBean.veiculo.placa}" />
				<p:message for="placa">
				</p:message>

				<p:outputLabel style="font-weight:bold" value="Cor: " for="cor" />
				<p:colorPicker required="true" requiredMessage="Campo Obrigatório"
					id="cor" value="#{caracteristicasBean.veiculo.cor}" />
				<p:message for="cor">
				</p:message>

				<h:outputLabel style="font-weight:bold" for="anoModelo"
					value="Ano Modelo: " />
				<p:spinner required="true" requiredMessage="Campo Obrigatório"
					id="anoModelo" min="1980" max="2015" value="#{caracteristicasBean.veiculo.anoModelo}" />
				<p:message for="anoModelo">
				</p:message>

				<h:outputLabel style="font-weight:bold" for="anoFabricacao"
					value="Ano Fabricação: " />
				<p:spinner required="true" requiredMessage="Campo Obrigatório"
					id="anoFabricacao" min="1980" max="2015" value="#{caracteristicasBean.veiculo.anoFabricacao}" />
				<p:message for="anoFabricacao">
				</p:message>

					<h:outputLabel style="font-weight:bold" for="tipoCombustivel"
					value="Tipo Combustivel: " />
				<p:selectOneMenu required="true" requiredMessage="Campo Obrigatório"
					style="width:300px;" id="tipoCombustivel" converter="genericEntityConverter" value="#{caracteristicasBean.veiculo.tipoCombustivel}">
				<f:selectItems value="#{tipoCombustivelBean.buscarCombustivel()}"
					var="tipoCombustivel" itemLabel="#{tipoCombustivel.nome}" itemValue="#{tipoCombustivel}"/>
				</p:selectOneMenu>
				<p:message for="tipoCombustivel">
				</p:message>


				
				 <h:outputLabel for="tabelaFipe" value="Tabela FIPE($):"
					style="font-weight:bold" />
				<p:inputText id="tabelaFipe" converter="ConverterPontoPorVirgula" required="true" 
					requiredMessage="Campo Obrigatório" value="#{caracteristicasBean.veiculo.fipe}" />
				<p:message for="tabelaFipe">
				</p:message>
				
			</h:panelGrid>
			<f:facet name="footer">
				<p:commandButton  action="#{caracteristicasBean.cadastrarCarro()}" update=":formConteudo" value="Enviar" />
			</f:facet>
		</p:panel>
	
	</ui:define>
</ui:composition>
</html>
